export default class ArrayUtil {
    static updateArray(array, item) {
        for (let i = 0, len = array.length; i < len; i++) {
            let temp = array[i]
            if (temp === item) {
                array.splice(i, 1)
                return
            }
        }
        array.push(item)
    }

    static clone(arr) {
        return arr.slice(0, arr.length)
    }

    static isEqual(arr1, arr2) {
        if (!(arr1 && arr2)) return false;
        if (arr1.length !== arr2.length) return false;
        for (let i = 0, l = arr1.length; i < l; i++) {
            if (arr1[i] !== arr2[i]) {
                return false;
            }
        }
        return true;
    }

    static remove(arr, item) {
        if(!arr)return;
        arr.splice(arr.indexOf(item),1)
    }
}